package com.eleadin.ruleengine.easyrules.rules;

import org.jeasy.rules.annotation.Action;
import org.jeasy.rules.annotation.Condition;
import org.jeasy.rules.annotation.Fact;
import org.jeasy.rules.annotation.Rule;
import org.jeasy.rules.api.Facts;

/**
 * @author tongw
 */
@Rule(name = "age rule", description = "Check if user is of legal age to buy alcohol")
public class AgeRule {

    @Condition
    public boolean checkAge(@Fact("age") int age) {
        return age >= 18;
    }

    @Action
    public void ableToBuyAlcohol(Facts facts) {
        System.out.println("Is legal age to buy alcohol!");
    }
}
